﻿Public Class CompositeCommand
    Inherits CommandBase
    Public Sub New(ByVal ParamArray Commands() As CommandBase)
        _Commands = New List(Of CommandBase)
        _Commands.AddRange(Commands)
        AddHandlers()
    End Sub
    Public Sub New(ByVal Commands As List(Of CommandBase))
        _Commands = Commands
        AddHandlers()
    End Sub
    Private Sub AddHandlers()
        For Each com As CommandBase In Commands
            AddHandler com.CssChanged, AddressOf MyBase.onCssChanged
            AddHandler com.ImagingChanged, AddressOf MyBase.onImagingChanged
        Next
    End Sub
    Public Property Commands() As List(Of CommandBase)
    Friend Overrides Sub Execute()
        For Each c As CommandBase In _Commands
            c.Execute()
        Next
    End Sub

    Friend Overrides Sub Undo()
        For Each c As CommandBase In _Commands
            c.Undo()
        Next
    End Sub
End Class
